//
//  FolderListViewController.m
//  SecretFolder
//
//  Created by Deepak Kumar on 25/06/12.
//  Copyright 2012 Frog. All rights reserved.
//

#import "FolderListViewController.h"


@implementation FolderListViewController
@synthesize mDelegate, mGalleryView;

#pragma mark -
#pragma mark View lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];

//	mFolderNameArray = [[NSArray alloc] initWithObjects:
//						@"Default",
//						@"Danger", 
//						@"Love",
//						@"Movie", 
//						@"Home",
//						@"Music", 
//						nil];

    self.mGalleryView.itemSize = CGSizeMake(140, 140);
    [self.mGalleryView reloadData];

	self.navigationItem.title = @"Choose Folder";
    NSDictionary *size = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Helvetica" size:19],UITextAttributeFont, nil];
    self.navigationController.navigationBar.titleTextAttributes = size;
    
}



#pragma mark -
#pragma mark ATArrayViewDelegate methods

- (NSInteger)numberOfItemsInArrayView:(ATArrayView *)arrayView {
    return 4;
}

- (UIView *)viewForItemInArrayView:(ATArrayView *)arrayView atIndex:(NSInteger)index
{
    DemoItemView *itemView = (DemoItemView *) [arrayView dequeueReusableItem];
    
    if (itemView == nil)
    {
        itemView = [[DemoItemView alloc] init];
        // WithFileName:mGalleryType==kProfileIcons?@"Avatar-%db.png": @"pageicon-%d.png"
        itemView.mDelegate = self;

        
       // itemView = [[DemoItemView alloc] init];
       // itemView.mDelegate = self;
    }
    
    itemView.mFileNameFormat = @"IT_Folder%d.png";

    [itemView setNeedsDisplay];
    
    return itemView;
}

// @"IT_Folder%d.png"

#pragma mark -
#pragma mark  DemoItemView Delegate
- (void) demoItemView:(DemoItemView *)pController index:(NSInteger)pIndex
{
    NSLog(@"demoItemView: %d", pIndex);
    [mDelegate folderListViewController:self index:pIndex];
   // [mDelegate profileListViewController:self index:pIndex];
    [self.navigationController popViewControllerAnimated:YES];
}


- (IBAction) cancelButton:(id)sender
{
	[self.navigationController popViewControllerAnimated:YES];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Override to allow orientations other than the default portrait orientation.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation)? YES : NO;
}

#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Relinquish ownership any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
	self.mDelegate = nil;
}


- (void)dealloc {
	mFolderNameArray = nil;
}


@end

